<!DOCTYPE html>
<!-- 管理员登录界面 -->
<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="layui/css/layui.css">
    <style type="text/css">
        .container {
            width: 420px;
            height: 320px;
            min-height: 320px;
            max-height: 320px;
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            margin: auto;
            padding: 20px;
            z-index: 130;
            border-radius: 8px;
            background-color: #fff;
            box-shadow: 0 3px 18px rgba(100, 0, 0, .5);
            font-size: 16px;
        }

        .close {
            background-color: white;
            border: none;
            font-size: 18px;
            margin-left: 410px;
            margin-top: -10px;
        }

        .layui-input {
            border-radius: 5px;
            width: 300px;
            height: 40px;
            font-size: 15px;
        }

        .layui-form-item {
            margin-left: -20px;
        }

        #logoid {
            margin-top: -16px;
            padding-left: 150px;
            padding-bottom: 15px;
        }

        .layui-btn {
            margin-left: -50px;
            border-radius: 5px;
            width: 350px;
            height: 40px;
            font-size: 15px;
        }

        .verity {
            width: 120px;
        }

        .font-set {
            font-size: 13px;
            text-decoration: none;
            margin-left: 120px;
        }

        a:hover {
            text-decoration: underline;
        }

        #img {
            width: 25px;
            height: 15px;
            position: absolute;
            right: 5px;
            margin-top: 12px;
            top: 1px;
            text-align: right;
        }

    </style>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <title>管理员用户登录</title>
</head>
<body>
<form class="layui-form" lay-filter="loginForm" id='form' onsubmit="return false">
    <div class="container">

        <div class="layui-form-mid layui-word-aux">
            <h3>管理员登录</h3>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">管理员</label>
            <div class="layui-input-block">
                <input type="text" name="number" placeholder="请输入管理员账户" required
                       lay-verify='required' autocomplete="on" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密 &nbsp;&nbsp;码</label>
            <div class="layui-input-inline">
                <input type="password" name="password" placeholder="请输入密码" required
                       lay-verify='required' autocomplete="on" class="layui-input"
                       id='user-login-password'>
            </div>
            <i><img id="img" onclick="hideShowPsw()" src='eyes/lock_eye.png'/></i>
        </div>


        <div class="layui-form-item">
            <div class="layui-input-block">
                <button  class="layui-btn" lay-submit lay-filter="adlogin">登陆</button>
            </div>
        </div>
        <a href="eplogin.html" class="font-set">企业登录</a>
    </div>
</form>
<script type="text/javascript" src="layui/layui.js"></script>
<script type='text/javascript'>
    var demoImg = document.getElementById('img');
    var PWD = document.getElementById("user-login-password");

    function hideShowPsw() {
        if (PWD.type == 'password') {
            PWD.type = 'text';
            demoImg.src = 'eyes/open_eye.png';
        } else {
            PWD.type = 'password';
            demoImg.src = 'eyes/lock_eye.png';
        }


    };
</script>
<script>
    layui.use(['form','layer'],function (){
        var form=layui.form;
        var layer=layui.layer;
        var $=layui.$;
        form.on('submit(adlogin)',function (data){
            var info=data.field;
            $.ajax({
                type:"post",
                data:info,
                dataType:"json",
                url:"/login/adminLogin",
                success:function (ret){
                    if(ret.code === 201){
                        layer.msg('管理员登录成功');
                        location.href='admain.html';
                    }
                    else{
                        layer.msg('管理员登录失败');
                    }
                },
                error:function (ret){
                    layer.msg('服务器出现错误');
                    layer.msg(ret.msg);

                }
            });



        });


    });

    </script>


</body>
</html>